#ifndef EVENT_HANDLER_HEADER
#define EVENT_HANDLER_HEADER

#include <queue>
#include <set>
#include <stack>
#include <cassert>
#include "Globals.h"


class GameManager;
class GameEntity;

struct InputStateRec {
	struct KeyboardStateRec {
		std::set<char> mKeysDown;
	} mKeyboardState;
};

//All events must inherit this
struct EventRec {
	EventRec( EVENT_TYPE t) {
		mType = t;
	}

	EVENT_TYPE mType;
};

struct InputEventRec : public EventRec {
	InputEventRec() : EventRec ( INPUT_EVENT),
		start(false) {}
	INPUT_EVENT_ACTION mAction;

	//Information about the input.
	bool start;

	//Information about the mouse position
	MouseInfoRec mouseInfo;
};

struct CollisionEventRec : public EventRec {
	CollisionEventRec() : EventRec ( COLLISION_EVENT) {}

	COLLISION_EVENT_ACTION mAction;

	glm::vec2 point;

	//Are collisions always between entities?
	GameEntity * entity1;
	GameEntity * entity2;	
};

//Handles all input events
class EventHandler {
public:
	EventHandler(GameManager * inMngr);

	//Handeling events
	void HandleEvent( const EventRec & inEvent );

private:
	
	void HandleInputEvent( const InputEventRec & inEvent );

	void HandleCollisionEvent( const CollisionEventRec & inEvent );
	
	GameManager * mManager;
	
	//Input state
	std::queue<InputEventRec> mInputEventQueue;

};

#endif